<template>
	<view class=" pb30">
		<!-- <view class="s-i u-flex u-flex-between" @click="goTo('/subpkg/my/rate')">
			<view class="l">赐予评价</view>
			<view class="r">
				<w-icon type="more" color="#999" size="36rpx"></w-icon>
			</view>
		</view> -->
		<view class="s-i u-flex u-flex-between" @click="goTo('/subpkg/my/unbind?bindstatus='+bindstatus)">
			<view class="l">{{bindMtext}}</view>
			<view class="r">
				<w-icon type="more" color="#999" size="32rpx"></w-icon>
			</view>
		</view>
		<view class="quit" ><text  @click="logout">退出登录</text></view>
		<view class="prot" @click="goTo('/pages/commer/PrivacyPolicy')"><text>《东哥烘焙用户协议》i《隐私政策》</text></view>
	</view>
</template>

<script>
	import wIcon from '@/components/w-icon.vue'
	export default{
		components:{
			wIcon,
		},
		data() {
			return {
				imgUrl:this.imgUrl,
				bindMtext:"解绑会员卡",
				bindstatus:1
			}
		},
		computed: {
		   
		},
		onLoad() {
			
		},
		onShow() {
			this.$a.GetOpenToken()
			this.getMyCard()
			// if(uni.getStorageSync("userInfo").cardNo){
			// 	this.bindMtext = "解绑会员卡"
			// 	this.bindstatus= 1
			// }else{
			// 	this.bindMtext = "绑定会员卡"
			// 	this.bindstatus = 0
			// }
		},
		methods: {
			logout(){
				this.$http.Logout({
					
				}).then(res => {
					uni.removeStorageSync("u_token");
					uni.removeStorageSync("access_token");
					uni.removeStorageSync("token_type");
					uni.removeStorageSync("userInfo");
					uni.removeStorageSync("store");
					uni.removeStorageSync("storeId");
					uni.removeStorageSync("isLogin");
					uni.showToast({
						title:res.msg,
						icon:"none"
					})
					uni.navigateTo({
						url:"/pages/index/index"
					})
				})
			},
			getMyCard(){
				uni.showLoading({
					title:"加载中"
				})
				this.$http.GetMyCard({
					
				}).then(res => {
					if(res.code==0){
						uni.hideLoading()
						if(res.content&&res.content.length>0&&res.content[0].cardno){
							this.bindMtext = "解绑会员卡"
							this.bindstatus= 1
						}else{
							this.bindMtext = "绑定会员卡"
							this.bindstatus = 0
						}
					}
					
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.s-i{
		background: #fff;height: 80rpx;line-height: 80rpx;
		font-size:28rpx ;color:#222 ;padding: 0 30rpx;
	}
	.quit,.prot{
		color: #BEB49D;font-size: 28rpx;
	}
	.quit{
		text-align: center;
		margin-top:170rpx ;
	}
	.prot{
		width: 100%;
		position: absolute;
		bottom:75rpx ;
		text-align: center;
	}
</style>